#include <iostream>
#include <memory>

#include "LogMessage.hpp"
#include "UdpServer.hpp"
#include "ExistReason.hpp"

void Usage()
{
    Log::LogMessage(Error, "Please enter:  ./EchoServer [ip] port");
}

int main(int argc, char* argv[])
{
    if (argc != 3 && argc != 2)
    {
        Usage();
        return USE_ERROR_MANUAL;
    }

    std::string ip = argv[1];
    uint16_t port = atoi(argv[argc - 1]);
    if (argc == 2)
        ip = "";
    std::unique_ptr<EchoServer> p(new EchoServer(port, ip));
    p->Start();

    return 0;
}